package com.somsoft.handjc.util;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;

import com.somsoft.handjc.xzzf.po.MonthInfo;

/**
 * 行政审批   数据获取
 * 
 * 
 */
public class XzspDataUtil {
	public static List<String> xzspDeptNames = null;
	
	//部门名称
		public static JSONArray getDeptNames() throws Exception {
			try {
				String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!getDeptNames.hand",new ArrayList<NameValuePair>());
				JSONArray jArray = new JSONArray(s);
				return jArray;
			} catch (Exception e) {
				throw e;
			}
		}
		
			//综合查询：综合时限查询、综合逻辑查询、综合异常结果查询
	
			//时限监察列表
			public static JSONArray sxjcList(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!sxjcList.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//异常监察列表
			public static JSONArray ycjcList(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!ycjcList.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//逻辑监察列表
			public static JSONArray ljjcList(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!ljjcList.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//监察明细--基本信息
			public static JSONObject detailBase(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!detailBase.hand",params);
					JSONObject obj = new JSONObject(s);
					return obj;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//监察明细--受理信息
			public static JSONObject detailShouli(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!detailShouli.hand",params);
					JSONObject obj = new JSONObject(s);
					return obj;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//监察明细--审批过程：承办、审核、批准
			public static JSONObject detailShenpiGuocheng(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!detailShenpiGuocheng.hand",params);
					JSONObject obj = new JSONObject(s);
					return obj;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//监察明细--特别程序
			public static JSONObject detailTbcx(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!detailTbcx.hand",params);
					JSONObject obj = new JSONObject(s);
					return obj;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//监察明细--办结
			public static JSONObject detailBanjie(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!detailBanjie.hand",params);
					JSONObject obj = new JSONObject(s);
					return obj;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//监察明细--监察信息
			public static JSONArray detailJcInfo(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!detailJcInfo.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//统计分析--业务量统计分析
			public static JSONArray businessCount(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!businessCount.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//统计分析--部门业务量统计分析
			public static JSONArray deptBusinessCount(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!deptBusinessCount.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//统计分析--异常环节统计分析
			public static JSONArray yichangPositionCount(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!yichangPositionCount.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//统计分析--办理结果统计分析
			public static JSONArray banliResultCount(List<NameValuePair> params) throws Exception {
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!banliResultCount.hand",params);
					JSONArray jArray = new JSONArray(s);
					return jArray;
				} catch (Exception e) {
					throw e;
				}
			}
			
			//统计分析--受理业务时间分布统计分析
			public static List<MonthInfo> businessTime(List<NameValuePair> params) throws Exception {
				List<MonthInfo> list = new ArrayList<MonthInfo>();
				try {
					String s = Utils.getJsonData(Utils.SERVER_IP+"/handweb/xzsp!businessTime.hand",params);
					JSONArray jArray = new JSONArray(s);
					for (int i = 0; i < jArray.length(); i++) {
						JSONObject obj = jArray.getJSONObject(i);
						MonthInfo mi = new MonthInfo();
						mi.setId(UUID.randomUUID().toString());
						mi.setMonthName(obj.getString("c_month"));
						mi.setMonthCount(obj.getDouble("c_count"));
						list.add(mi);
					}
					return list;
				} catch (Exception e) {
					throw e;
				}
			}
}

